import { post } from '@feidao-factory/send-msg/browser/request';
import global from '../../core/global';

export default async function login(rout: string, msg: object) {
	try {
		const url = `${global.host}/${rout}`;
		const res = await post(url, JSON.stringify(msg));
		return JSON.parse(res.responseText);
	} catch (res) {
		throw new Error(res.responseText);
	}
}
